home *** CD-ROM | disk | FTP | other *** search
/ Internet Publisher's Toolbox 2.0 / Internet Publisher's Toolbox.iso / info / beginner / beggde.txt
Encoding:
Text File  |  1995-08-07  |  31.3 KB  |  895 lines

  1. A Beginner's Guide to HTML
  2.  
  3. This is a primer for producing documents in HTML, the markup language used by
  4. the World Wide Web.
  5.  
  6.    * Acronym Expansion
  7.    * What This Primer Doesn't Cover
  8.    * Creating HTML Documents
  9.         o The Minimal HTML Document
  10.         o Basic Markup Tags
  11.              + Titles
  12.              + Headings
  13.              + Paragraphs
  14.         o Linking to Other Documents
  15.              + Relative Links Versus Absolute Pathnames
  16.              + Uniform Resource Locator
  17.              + Anchors to Specific Sections in Other Documents
  18.              + Anchors to Specific Sections Within the Current Document
  19.    * Additional Markup Tags
  20.         o Lists
  21.              + Unnumbered Lists
  22.              + Numbered Lists
  23.              + Definition Lists
  24.              + Nested Lists
  25.         o Preformatted Text
  26.         o Extended Quotes
  27.         o Addresses
  28.    * Character Formatting
  29.         o Physical Versus Logical: Use Logical Tags When Possible
  30.              + Logical Styles
  31.              + Physical Styles
  32.         o Using Character Tags
  33.         o Special Characters
  34.              + Escape Sequences
  35.              + Forced Line Breaks
  36.              + Horizontal Rules
  37.    * In-line Images
  38.         o Alternate Text for Viewers That Can't Display Images
  39.    * External Images, Sounds, and Animations
  40.    * Troubleshooting
  41.         o Avoid Overlapping Tags
  42.         o Embed Anchors and Character Tags, But Not Anything Else
  43.         o Check Your Links
  44.    * A Longer Example
  45.    * For More Information
  46.         o Fill-out Forms
  47.         o Style Guides
  48.         o Other Introductory Documents
  49.         o Additional References
  50.  
  51. Acronym Expansion
  52.  
  53. WWW  World Wide Web (or Web, for short).
  54. SGML
  55.      Standard Generalized Markup Language -- this is a standard for describing
  56.      markup languages.
  57. DTD
  58.      Document Type Definition -- this is a specific markup language, written
  59.      using SGML.
  60. HTML
  61.      HyperText Markup Language -- HTML is a SGML DTD. In practical terms, HTML
  62.      is a collection of styles (indicated by markup tags) that define the
  63.      various components of a World Wide Web document.
  64.  
  65. What This Primer Doesn't Cover
  66.  
  67. This primer assumes that you have:
  68.  
  69.    * at least a passing knowledge of how to use NCSA Mosaic or some other Web
  70.      browser
  71.    * a general understanding of how Web servers and client browsers work
  72.    * access to a Web server for which you would like to produce HTML documents,
  73.      or that you wish to produce HTML documents for personal use
  74.  
  75. Creating HTML Documents
  76.  
  77. HTML documents are in plain (also known as ASCII) text format and can be
  78. created using any text editor (e.g., Emacs or vi on UNIX machines). A couple of
  79. Web browsers (tkWWW for X Window System machines and CERN's Web browser for
  80. NeXT computers) include rudimentary HTML editors in a WYSIWYG environment.
  81. There are also some WYSIWIG editors available now (e.g. HotMetal for Sun
  82. Sparcstations, HTML Edit for Macintoshes). You may wish to try one of them
  83. first before delving into the details of HTML.
  84.  
  85.      You can preview a document in progress with NCSA Mosaic (and some
  86.      other Web browsers). Open it with the Open Local command under the
  87.      File menu.
  88.  
  89.      After you edit the source HTML file, save the changes. Return to NCSA
  90.      Mosaic and Reload the document. The changes are reflected in the
  91.      on-screen display.
  92.  
  93. The Minimal HTML Document
  94.  
  95. Here is a bare-bones example of HTML:
  96.  
  97.     <TITLE>The simplest HTML example</TITLE>
  98.     <H1>This is a level-one heading</H1>
  99.     Welcome to the world of HTML.
  100.     This is one paragraph.<P>
  101.     And this is a second.<P>
  102.  
  103. Click here to see the formatted version of the example.
  104.  
  105. HTML uses markup tags to tell the Web browser how to display the text. The
  106. above example uses:
  107.  
  108.    * the <TITLE> tag (and corresponding </TITLE> tag), which specifies the
  109.      title of the document
  110.    * the <H1> header tag (and corresponding </H1>)
  111.    * the <P> paragraph-separator tag
  112.  
  113. HTML tags consist of a left angle bracket (<), (a ``less than'' symbol to
  114. mathematicians), followed by name of the tag and closed by a right angular
  115. bracket (>). Tags are usually paired, e.g. <H1> and </H1>. The ending tag looks
  116. just like the starting tag except a slash (/) precedes the text within the
  117. brackets. In the example, <H1> tells the Web browser to start formatting a
  118. level-one heading; </H1> tells the browser that the heading is complete.
  119.  
  120. The primary exception to the pairing rule is the <P> tag. There is no such
  121. thing as </P>.
  122.  
  123. NOTE: HTML is not case sensitive. <title> is equivalent to <TITLE> or <TiTlE>.
  124.  
  125. Not all tags are supported by all World Wide Web browsers. If a browser does
  126. not support a tag, it just ignores it.
  127.  
  128. Basic Markup Tags
  129.  
  130. Title
  131.  
  132. Every HTML document should have a title. A title is generally displayed
  133. separately from the document and is used primarily for document identification
  134. in other contexts (e.g., a WAIS search). Choose about half a dozen words that
  135. describe the document's purpose.
  136.  
  137.      In the X Window System and Microsoft Windows versions of NCSA Mosaic,
  138.      the Document Title field is at the top of the screen just below the
  139.      pulldown menus. In NCSA Mosaic for Macintosh, text tagged as <TITLE>
  140.      appears as the window title.
  141.  
  142. Headings
  143.  
  144. HTML has six levels of headings, numbered 1 through 6, with 1 being the most
  145. prominent. Headings are displayed in larger and/or bolder fonts than normal
  146. body text. The first heading in each document should be tagged <H1>. The syntax
  147. of the heading tag is:
  148.  
  149. <Hy>Text of heading </Hy >
  150.  
  151. where y is a number between 1 and 6 specifying the level of the heading.
  152.  
  153. For example, the coding for the ``Headings'' section heading above is
  154.  
  155.     <H3>Headings</H3>
  156.  
  157. Title versus first heading
  158.  
  159. In many documents, the first heading is identical to the title. For multipart
  160. documents, the text of the first heading should be suitable for a reader who is
  161. already browsing related information (e.g., a chapter title), while the title
  162. tag should identify the document in a wider context (e.g., include both the
  163. book title and the chapter title, although this can sometimes become overly
  164. long).
  165.  
  166. Paragraphs
  167.  
  168. Unlike documents in most word processors, carriage returns in HTML files aren't
  169. significant. Word wrapping can occur at any point in your source file, and
  170. multiple spaces are collapsed into a single space. (There are couple of
  171. exceptions; space following a <P> or <Hy> tag, for example, is ignored.) Notice
  172. that in the bare-bones example, the first paragraph is coded as
  173.  
  174.     Welcome to HTML.
  175.     This is the first paragraph. <P>
  176.  
  177. In the source file, there is a line break between the sentences. A Web browser
  178. ignores this line break and starts a new paragraph only when it reaches a <P>
  179. tag.
  180.  
  181. Important: You must separate paragraphs with <P>. The browser ignores any
  182. indentations or blank lines in the source text. HTML relies almost entirely on
  183. the tags for formatting instructions, and without the <P> tags, the document
  184. becomes one large paragraph. (The exception is text tagged as ``preformatted,''
  185. which is explained below.) For instance, the following would produce identical
  186. output as the first bare-bones HTML example:
  187.  
  188.     <TITLE>The simplest HTML example</TITLE><H1>This is a level
  189.     one heading</H1>Welcome to the world of HTML. This is one
  190.     paragraph.<P>And this is a second.<P>
  191.  
  192. However, to preserve readability in HTML files, headings should be on separate
  193. lines, and paragraphs should be separated by blank lines (in addition to the
  194. <P> tags).
  195.  
  196.      NCSA Mosaic handles <P> by ending the current paragraph and inserting
  197.      a blank line.
  198.  
  199. In HTML+, a successor to HTML currently in development, <P> becomes a
  200. ``container'' of text, just as the text of a level-one heading is ``contained''
  201. within<H1> ... </H1>:
  202.  
  203.     <P>
  204.     This is a paragraph in HTML+.
  205.     </P>
  206.  
  207. The difference is that the </P> closing tag can always be omitted. (That is, if
  208. a browser sees a <P>, it knows that there must be an implied </P> to end the
  209. previous paragraph.) In other words, in HTML+, <P> is a beginning-of-paragraph
  210. marker.
  211.  
  212. The advantage of this change is that you will be able to specify formatting
  213. options for a paragraph. For example, in HTML+, you will be able to center a
  214. paragraph by coding
  215.  
  216.     <P ALIGN=CENTER>
  217.     This is a centered paragraph. This is HTML+, so you can't do it yet.
  218.  
  219. This change won't effect any documents you write now, and they will continue to
  220. look just the same with HTML+ browsers.
  221.  
  222. Linking to Other Documents
  223.  
  224. The chief power of HTML comes from its ability to link regions of text (and
  225. also images) to another document. The browser highlights these regions (usually
  226. with color and/or underlines) to indicate that they are hypertext links (often
  227. shortened to hyperlinks or simply links).
  228.  
  229. HTML's single hypertext-related tag is <A>, which stands for anchor. To include
  230. an anchor in your document:
  231.  
  232.   1. Start the anchor with <A . (There's a space after the A.)
  233.   2. Specify the document that's being pointed to by entering the parameter
  234.      HREF="filename" followed by a closing right angle bracket: >
  235.   3. Enter the text that will serve as the hypertext link in the current
  236.      document.
  237.   4. Enter the ending anchor tag: </A>.
  238.  
  239. Here is an sample hypertext reference:
  240.  
  241.     <A HREF="MaineStats.html">Maine</A>
  242.  
  243. This entry makes the word ``Maine'' the hyperlink to the document
  244. MaineStats.html, which is in the same directory as the first document. You can
  245. link to documents in other directories by specifying the relative path from the
  246. current document to the linked document. For example, a link to a file
  247. NJStats.html located in the subdirectory AtlanticStates would be:
  248.  
  249.     <A HREF="AtlanticStates/NJStats.html">New Jersey</A>
  250.  
  251. These are called relative links. You can also use the absolute pathname of the
  252. file if you wish. Pathnames use the standard UNIX syntax.
  253.  
  254. Relative Links Versus Absolute Pathnames
  255.  
  256. In general, you should use relative links, because
  257.  
  258.   1. You have less to type.
  259.   2. It's easier to move a group of documents to another location, because the
  260.      relative path names will still be valid.
  261.  
  262. However, use absolute pathnames when linking to documents that are not directly
  263. related. For example, consider a group of documents that comprise a user
  264. manual. Links within this group should be relative links. Links to other
  265. documents (perhaps a reference to related software) should use full path names.
  266. This way, if you move the user manual to a different directory, none of the
  267. links would have to be updated.
  268.  
  269. Uniform Resource Locator
  270.  
  271. The World Wide Web uses Uniform Resource Locators (URLs) to specify the
  272. location of files on other servers. A URL includes the type of resource being
  273. accessed (e.g., gopher, WAIS), the address of the server, and the location of
  274. the file. The syntax is:
  275.  
  276. scheme://host.domain[:port]/path/filename
  277.  
  278. where scheme is one of
  279.  
  280. file
  281.      a file on your local system, or a file on an anonymous FTP server
  282. http
  283.      a file on a World Wide Web server
  284. gopher
  285.      a file on a Gopher server
  286. WAIS
  287.      a file on a WAIS server
  288. news
  289.      an Usenet newsgroup
  290. telnet
  291.      a connection to a Telnet-based service
  292.  
  293. The port number can generally be omitted. (That means unless someone tells you
  294. otherwise, leave it out.)
  295.  
  296. For example, to include a link to this primer in your document, you would use
  297.  
  298.     <A HREF = "http://www.ncsa.uiuc.edu/General/Internet/WWW/HTMLPrimer.html">
  299.     NCSA's Beginner's Guide to HTML</A>
  300.  
  301. This would make the text ``NCSA's Beginner's Guide to HTML'' a hyperlink to
  302. this document.
  303.  
  304. For more information on URLs, look at
  305.  
  306.    *  WWW Names and Addresses, URIs, URLs, URNs, written by people at CERN
  307.    *  A Beginner's Guide to URLs, located on the NCSA Mosaic Help menu
  308.  
  309. Links to Specific Sections in Other Documents
  310.  
  311. Anchors can also be used to move to a particular section in a document. Suppose
  312. you wish to set a link from document A and a specific section in document B.
  313. (Call this file documentB.html.) First you need to set up a named anchor in
  314. document B. For example, to set up an anchor named ``Jabberwocky'' to document
  315. B, enter
  316.  
  317.     Here's <A NAME = "Jabberwocky">some text</a>
  318.  
  319. Now when you create the link in document A, include not only the filename, but
  320. also the named anchor, separated by a hash mark (#).
  321.  
  322.     This is my <A HREF = "documentB.html#Jabberwocky">link</A> to document B.
  323.  
  324. Now clicking on the word ``link'' in document A sends the reader directly to
  325. the words ``some text'' in document B.
  326.  
  327. Links to Specific Sections Within the Current Document
  328.  
  329. The technique is exactly the same except the filename is omitted.
  330.  
  331. For example, to link to the Jabberwocky anchor from within the same file
  332. (Document B), use
  333.  
  334.     This is <A HREF = "#Jabberwocky">Jabberwocky link</A> from within Document B.
  335.  
  336. Additional Markup Tags
  337.  
  338. The preceding is sufficient to produce simple HTML documents. For more complex
  339. documents, HTML has tags for several types of lists, preformatted sections,
  340. extended quotations, character formatting, and other items.
  341.  
  342. Lists
  343.  
  344. HTML supports unnumbered, numbered, and definition lists.
  345.  
  346. Unnumbered Lists
  347.  
  348. To make an unnumbered list,
  349.  
  350.   1. Start with an opening list <UL> tag.
  351.   2. Enter the <LI> tag followed by the individual item. (No closing </LI> tag
  352.      is needed.)
  353.   3. End with a closing list </UL> tag.
  354.  
  355. Below an example two-item list:
  356.  
  357.     <UL>
  358.     <LI> apples
  359.     <LI> bananas
  360.     </UL>
  361.  
  362. The output is:
  363.  
  364.    * apples
  365.    * bananas
  366.  
  367. The <LI> items can contain multiple paragraphs. Just separate the paragraphs
  368. with the <P> paragraph tags.
  369.  
  370. Numbered Lists
  371.  
  372. A numbered list (also called an ordered list, from which the tag name derives)
  373. is identical to an unnumbered list, except it uses <OL> instead of <UL>. The
  374. items are tagged using the same <LI> tag. The following HTML code
  375.  
  376.     <OL>
  377.     <LI> oranges
  378.     <LI> peaches
  379.     <LI> grapes
  380.     </OL>
  381.  
  382. produces this formatted output:
  383.  
  384.   1. oranges
  385.   2. peaches
  386.   3. grapes
  387.  
  388. Definition Lists
  389.  
  390. A definition list usually consists of alternating a term (abbreviated as DT)
  391. and a definition (abbreviated as DD). Web browsers generally format the
  392. definition on a new line.
  393.  
  394. The following is an example of a definition list:
  395.  
  396.     <DL>
  397.     <DT> NCSA
  398.     <DD> NCSA, the National Center for Supercomputing Applications,
  399.          is located on the campus of the University of Illinois
  400.          at Urbana-Champaign. NCSA is one of the participants in the
  401.          National MetaCenter for Computational Science and Engineering.
  402.     <DT> Cornell Theory Center
  403.     <DD> CTC is located on the campus of Cornell University in Ithaca,
  404.          New York. CTC is another participant in the National MetaCenter
  405.          for Computational Science and Engineering.
  406.     </DL>
  407.  
  408. The output looks like:
  409.  
  410. NCSA
  411.      NCSA, the National Center for Supercomputing Applications, is located on
  412.      the campus of the University of Illinois at Urbana-Champaign. NCSA is one
  413.      of the participants in the National MetaCenter for Computational Science
  414.      and Engineering.
  415. Cornell Theory Center
  416.      CTC is located on the campus of Cornell University in Ithaca, New York.
  417.      CTC is another participant in the National MetaCenter for Computational
  418.      Science and Engineering.
  419.  
  420. The <DT> and <DD> entries can contain multiple paragraphs (separated by <P>
  421. paragraph tags), lists, or other definition information.
  422.  
  423. Nested Lists
  424.  
  425. Lists can be arbitrarily nested, although in practice you probably should limit
  426. the nesting to three levels. You can also have a number of paragraphs, each
  427. containing a nested list, in a single list item.
  428.  
  429. An example nested list:
  430.  
  431.     <UL>
  432.     <LI> A few New England states:
  433.         <UL>
  434.         <LI> Vermont
  435.         <LI> New Hampshire
  436.         </UL>
  437.     <LI> One Midwestern state:
  438.         <UL>
  439.         <LI> Michigan
  440.         </UL>
  441.     </UL>
  442.  
  443. The nested list is displayed as
  444.  
  445.    * A few New England states:
  446.         o Vermont
  447.         o New Hampshire
  448.    * One Midwestern state:
  449.         o Michigan
  450.  
  451. Preformatted Text
  452.  
  453. Use the <PRE> tag (which stands for ``preformatted'') to generate text in a
  454. fixed-width font and cause spaces, new lines, and tabs to be significant. (That
  455. is, multiple spaces are displayed as multiple spaces, and lines break in the
  456. same locations as in the source HTML file.) This is useful for program
  457. listings. For example, the following lines
  458.  
  459.     <PRE>
  460.       #!/bin/csh
  461.       cd $SCR
  462.       cfs get mysrc.f:mycfsdir/mysrc.f
  463.       cfs get myinfile:mycfsdir/myinfile
  464.       fc -02 -o mya.out mysrc.f
  465.       mya.out
  466.       cfs save myoutfile:mycfsdir/myoutfile
  467.       rm *
  468.     </PRE>
  469.  
  470. display as
  471.  
  472.       #!/bin/csh
  473.       cd $SCR
  474.       cfs get mysrc.f:mycfsdir/mysrc.f
  475.       cfs get myinfile:mycfsdir/myinfile
  476.       fc -02 -o mya.out mysrc.f
  477.       mya.out
  478.       cfs save myoutfile:mycfsdir/myoutfile
  479.       rm *
  480.  
  481. Hyperlinks can be used within <PRE> sections. You should avoid using other HTML
  482. tags within <PRE> sections, however.
  483.  
  484. Note that because <, >, and & have special meaning in HTML, you have to use
  485. their escape sequences (<, >, and &, respectively) to enter these
  486. characters. See the section Special Characters for more information.
  487.  
  488. Extended Quotations
  489.  
  490. Use the <BLOCKQUOTE> tag to include quotations in a separate block on the
  491. screen. Most browsers generally indent to separate it from surrounding text.
  492.  
  493. An example:
  494.  
  495.     <BLOCKQUOTE>
  496.     I still have a dream. It is a dream deeply rooted in the
  497.     American dream. <P>
  498.     I have a dream that one day this nation will rise up and
  499.     live out the true meaning of its creed. We hold these truths
  500.     to be self-evident that all men are created equal. <P>
  501.     </BLOCKQUOTE>
  502.  
  503. The result is:
  504.  
  505.      I still have a dream. It is a dream deeply rooted in the American
  506.      dream.
  507.  
  508.      I have a dream that one day this nation will rise up and live out the
  509.      true meaning of its creed. We hold these truths to be self-evident
  510.      that all men are created equal.
  511.  
  512. Addresses
  513.  
  514. The <ADDRESS> tag is generally used to specify the author of a document and a
  515. means of contacting the author (e.g., an email address). This is usually the
  516. last item in a file.
  517.  
  518. For example, the last line of the online version of this guide is
  519.  
  520.     <ADDRESS>
  521.     A Beginner's Guide to HTML / NCSA / pubs@ncsa.uiuc.edu
  522.     </ADDRESS>
  523.  
  524. The result is
  525. A Beginner's Guide to HTML / NCSA / pubs@ncsa.uiuc.edu
  526.  
  527. NOTE: <ADDRESS> is not used for postal addresses. See ``Forced Line Breaks'' on
  528. page 10 to see how to format postal addresses.
  529.  
  530. Character Formatting
  531.  
  532. You can code individual words or sentences with special styles. There are two
  533. types of styles: logical and physical. Logical styles tag text according to its
  534. meaning, while physical styles specify the specific appearance of a section.
  535. For example, in the preceding sentence, the words ``logical styles'' was tagged
  536. as a ``definition.'' The same effect (formatting those words in italics), could
  537. have been achieved via a different tag that specifies merely ``put these words
  538. in italics.''
  539.  
  540. Physical Versus Logical: Use Logical Styles When Possible
  541.  
  542. If physical and logical styles produce the same result on the screen, why are
  543. there both? We devolve, for a couple of paragraphs, into the philosophy of
  544. SGML, which can be summed in a Zen-like mantra: ``Trust your browser.''
  545.  
  546. In the ideal SGML universe, content is divorced from presentation. Thus, SGML
  547. tags a level-one heading as a level-one heading, but does not specify that the
  548. level-one heading should be, for instance, 24-point bold Times centered on the
  549. top of a page. The advantage of this approach (it's similar in concept to style
  550. sheets in many word processors) is that if you decide to change level-one
  551. headings to be 20-point left-justified Helvetica, all you have to do is change
  552. the definition of the level-one heading in the presentation device (i.e., your
  553. World Wide Web browser).
  554.  
  555. The other advantage of logical tags is that they help enforce consistency in
  556. your documents. It's easier to tag something as <H1> than to remember that
  557. level-one headings are 24-point bold Times or whatever. The same is true for
  558. character styles. For example, consider the <STRONG> tag. Most browsers render
  559. it in bold text. However, it is possible that a reader would prefer that these
  560. sections be displayed in red instead. Logical styles offer this flexibility.
  561.  
  562. Logical Styles
  563.  
  564. <DFN>
  565.      for a word being defined. Typically displayed in italics. (NCSA Mosaic is
  566.      a World Wide Web browser.)
  567. <EM>
  568.      for emphasis. Typically displayed in italics. (Watch out for pickpockets.)
  569. <CITE>
  570.      for titles of books, films, etc. Typically displayed in italics. (A
  571.      Beginner's Guide to HTML)
  572. <CODE>
  573.      for snippets of computer code. Displayed in a fixed-width font. (The
  574.      <stdio.h> header file)
  575. <KBD>
  576.      for user keyboard entry. Should be displayed in a bold fixed-width font,
  577.      but many browsers render it in the plain fixed-width font. (Enter passwd
  578.      to change your password.)
  579. <SAMP>
  580.      for computer status messages. Displayed in a fixed-width font.
  581.      (Segmentation fault: Core dumped.)
  582. <STRONG>
  583.      for strong emphasis. Typically displayed in bold. (Important)
  584. <VAR>
  585.      for a ``metasyntactic'' variable, where the user is to replace the
  586.      variable with a specific instance. Typically displayed in italics. (rm
  587.      filename deletes the file.)
  588.  
  589. Physical Styles
  590.  
  591. <B>  bold text
  592. <I>  italic text
  593. <TT>
  594.      typewriter text, e.g. fixed-width font.
  595.  
  596. Using Character Tags
  597.  
  598. To apply a character style,
  599.  
  600.   1. Start with <tag>, where tag is the desired character formatting tag, to
  601.      indicate the beginning of the tagged text.
  602.   2. Enter the tagged text.
  603.   3. End the passage with </tag>.
  604.  
  605. Special Characters
  606.  
  607. Escape Sequences
  608.  
  609. Four characters of the ASCII character set -- the left angle bracket (<), the
  610. right angle bracket (>), the ampersand (&) and the double quote (") -- have
  611. special meaning within HTML and therefore cannot be used ``as is'' in text.
  612. (The angle brackets are used to indicate the beginning and end of HTML tags,
  613. and the ampersand is used to indicate the beginning of an escape sequence.)
  614.  
  615. To use one of these characters in an HTML document, you must enter its escape
  616. sequence instead:
  617.  
  618. <
  619.      the escape sequence for <
  620. >
  621.      the escape sequence for >
  622. &
  623.      the escape sequence for &
  624. "
  625.      the escape sequence for "
  626.  
  627. Additional escape sequences support accented characters. For example:
  628.  
  629. ö
  630.      the escape sequence for a lowercase o with an umlaut: ÷
  631. ñ
  632.      the escape sequence for a lowercase n with an tilde: ±
  633. È
  634.      the escape sequence for an uppercase E with a grave accent: ╚
  635.  
  636. A full list of supported characters can be found at CERN.
  637.  
  638. NOTE: Unlike the rest of HTML, the escape sequences are case sensitive. You
  639. cannot, for instance, use < instead of <.
  640.  
  641. Forced Line Breaks
  642.  
  643. The <BR> tag forces a line break with no extra space between lines. (By
  644. contrast, most browsers format the <P> paragraph tag with an additional blank
  645. line to more clearly indicate the beginning the new paragraph.)
  646.  
  647. One use of <BR> is in formatting addresses:
  648.  
  649.     National Center for Supercomputing Applications<BR>
  650.     605 East Springfield Avenue<BR>
  651.     Champaign, Illinois 61820-5518<BR>
  652.  
  653. Horizontal Rules
  654.  
  655. The <HR> tag produces a horizontal line the width of the browser window.
  656.  
  657. In-line Images
  658.  
  659. Most Web browsers can display in-line images (that is, images next to text)
  660. that are in X Bitmap (XBM) or GIF format. Each image takes time to process and
  661. slows down the initial display of the document, so generally you should not
  662. include too many or overly large images.
  663.  
  664. To include an in-line image, use
  665.  
  666.     <IMG SRC=image_URL>
  667.  
  668. where image_URL is the URL of the image file. The syntax for IMG SRC URLs is
  669. identical to that used in an anchor HREF. If the image file is a GIF file, then
  670. the filename part of image_URL must end with .gif. Filenames of X Bitmap images
  671. must end with .xbm.
  672.  
  673.   By default the bottom of an image is aligned with the text as shown in this
  674. paragraph.
  675.  
  676.    Add the ALIGN=TOP option if you want the browser to align adjacent text with
  677. the top of the image as shown in this paragraph. The full in-line image tag
  678. with the top alignment is:
  679.  
  680.     <IMG ALIGN=top SRC=image_URL>
  681.  
  682.    ALIGN=MIDDLE aligns the text with the center of the image.
  683.  
  684. Alternate Text for Browsers That Can't Display Images
  685.  
  686. Some World Wide Web browsers, primarily those that run on VT100 terminals,
  687. cannot display images. The ALT option allows you to specify text to be
  688. displayed when an image cannot be. For example:
  689.  
  690.     <IMG SRC = "UpArrow.gif" ALT = "Up">
  691.  
  692. where UpArrow.gif is the picture of an upward pointing arrow. With NCSA Mosaic
  693. and other graphics-capable viewers, the user sees the up arrow graphic. With a
  694. VT100 browser, such as lynx, the user sees the word ``Up.''
  695.  
  696. External Images, Sounds, and Animations
  697.  
  698. You may want to have an image open as a separate document when a user activates
  699. a link on either a word or a smaller, in-line version of the image included in
  700. your document. This is considered an external image and is useful if you do not
  701. wish to slow down the loading of the main document with large in-line images.
  702.  
  703. To include a reference to an external image, use
  704.  
  705.     <A HREF = image_URL>link anchor</A>
  706.  
  707. Use the same syntax is for links to external animations and sounds. The only
  708. difference is the file extension of the linked file. For example,
  709.  
  710. <A HREF = "QuickTimeMovie.mov">link anchor</A>
  711.  
  712. specifies a link to a QuickTime movie. Some common file types and their
  713. extensions are:
  714.  
  715. File Type
  716.      Extension
  717. Plain text
  718.      .txt
  719. HTML document
  720.      .html
  721. GIF image
  722.      .gif
  723. TIFF image
  724.      .tiff
  725. XBM bitmap image
  726.      .xbm
  727. JPEG image
  728.      .jpg or .jpeg
  729. PostScript file
  730.      .ps
  731. AIFF sound
  732.      .aiff
  733. AU sound
  734.      .au
  735. QuickTime movie
  736.      .mov
  737. MPEG movie
  738.      .mpeg or .mpg
  739.  
  740. Make sure your intended audience has the necessary viewers. Most UNIX
  741. workstations, for instance, cannot view QuickTime movies.
  742.  
  743. Troubleshooting
  744.  
  745. Avoid Overlapping Tags
  746.  
  747. Consider this snippet of HTML:
  748.  
  749.     <B>This is an example of <DFN>overlapping</B> HTML tags.</DFN>
  750.  
  751. The word ``overlapping'' is contained within both the <B> and <DFN> tags. How
  752. does the browser format it? You won't know until you look, and different
  753. browsers will likely react differently. In general, avoid overlapping tags.
  754.  
  755. Embed Anchors and Character Tags, But Nothing Else
  756.  
  757. It is acceptable to embed anchors within another HTML element:
  758.  
  759.     <H1><A HREF = "Destination.html">My heading</A></H1>
  760.  
  761. Do not embed a heading or another HTML element within an anchor:
  762.  
  763.     <A HREF = "Destination.html">
  764.     <H1>My heading</H1>
  765.     </A>
  766.  
  767. Although most browsers currently handle this example, it is forbidden by the
  768. official HTML and HTML+ specifications, and will not work with future browsers.
  769.  
  770. Character tags modify the appearance of other tags:
  771.  
  772.     <UL><LI><B>A bold list item</B>
  773.         <UL>
  774.         <LI><I>An italic list item</I>
  775.     </UL>
  776.  
  777. However, avoid embedding other types of HTML element tags. For example, it is
  778. tempting to embed a heading within a list, in order to make the font size
  779. larger:
  780.  
  781.     <UL><LI><H1>A large heading</H1>
  782.         <UL>
  783.         <LI><H2>Something slightly smaller</H2>
  784.     </UL>
  785.  
  786. Although some browsers, such as NCSA Mosaic for the X Window System, format
  787. this construct quite nicely, it is unpredictable (because it is undefined) what
  788. other browsers will do. For compatibility with all browsers, avoid these kinds
  789. of constructs.
  790.  
  791. What's the difference between embedding a <B> within a <LI> tag as opposed to
  792. embedding a <H1> within a <LI>? This is again a question of SGML. The semantic
  793. meaning of <H1> is that it's the main heading of a document and that it should
  794. be followed by the content of the document.Thus it doesn't make sense to find a
  795. <H1> within a list.
  796.  
  797. Character formatting tags also are generally not additive. You might expect
  798. that
  799.  
  800.     <B><I>some text</I></B>
  801.  
  802. would produce bold-italic text. On some browsers it does; other browsers
  803. interpret only the innermost tag (here, the italics).
  804.  
  805. Check Your Links
  806.  
  807. When an <IMG> tag points at an image that does not exist, a dummy image is
  808. substituted. When this happens, make sure that the referenced image does in
  809. fact exist, that the hyperlink has the correct information in the URL, and that
  810. the file permission is set appropriately (world-readable).
  811.  
  812. A Longer Example
  813.  
  814. Here is a longer example of an HTML document:
  815.  
  816.     <HEAD>
  817.     <TITLE>A Longer Example</TITLE>
  818.     </HEAD>
  819.     <BODY>
  820.     <H1>A Longer Example</H1>
  821.     This is a simple HTML document. This is the first
  822.     paragraph. <P>
  823.     This is the second paragraph, which shows special effects.  This is a
  824.     word in <I>italics</I>.  This is a word in <B>bold</B>.
  825.     Here is an in-lined GIF image: <IMG SRC = "myimage.gif">.
  826.     <P>
  827.     This is the third paragraph, which demonstrates links.  Here is
  828.     a hypertext link from the word <A HREF = "subdir/myfile.html">foo</A>
  829.     to a document called "subdir/myfile.html". (If you
  830.     try to follow this link, you will get an error screen.) <P>
  831.     <H2>A second-level header</H2>
  832.     Here is a section of text that should display as a
  833.     fixed-width font: <P>
  834.     <PRE>
  835.         On the stiff twig up there
  836.         Hunches a wet black rook
  837.         Arranging and rearranging its feathers in the rain ...
  838.     </PRE>
  839.     This is a unordered list with two items: <P>
  840.     <UL>
  841.     <LI> cranberries
  842.     <LI> blueberries
  843.     </UL>
  844.     This is the end of my example document. <P>
  845.     <ADDRESS>Me (me@mycomputer.univ.edu)</ADDRESS>
  846.     </BODY>
  847.  
  848. Click here to see the formatted version.
  849.  
  850. In addition to tags already discussed, this example also uses the <HEAD> ...
  851. </HEAD> and <BODY> ... </BODY> tags, which separate the document into
  852. introductory information about the document and the main text of the document.
  853. These tags don't change the appearance of the formatted document at all, but
  854. are useful for several purposes (for example, NCSA Mosaic for Macintosh 2.0,
  855. for example, allows you to browse just the header portion of document before
  856. deciding whether to download the rest), and it is recommended that you use
  857. these tags.
  858.  
  859. For More Information
  860.  
  861. This guide is only an introduction to HTML and not a comprehensive reference.
  862. Below are additional sources of information.
  863.  
  864. Fill-out Forms
  865.  
  866. One major feature not discussed here is fill-out forms, which allows users to
  867. return information to the World Wide Web server. For information on fill-out
  868. forms, look at this Fill-out Forms Overview
  869.  
  870. Style Guides
  871.  
  872. The following offer advice on how to write ``good'' HTML:
  873.  
  874.    *  Composing Good HTML
  875.    *  CERN's style guide for online hypert
  876.  
  877. Other Introductory Documents
  878.  
  879. These cover similar information as this guide:
  880.  
  881.    *  How to Write HTML Files
  882.    *  Introduction to HTML
  883.  
  884. Additional References
  885.  
  886.    *  The HTML Quick Reference Guide, which provides a comprehensive listing of
  887.      HTML codes
  888.    *  The official HTML specification
  889.    * A description of SGML, the Standard Generalized Markup Language
  890.    *  Dan Connolly's HTML Design Notebook. Dan Connolly is one of the
  891.      originators of HTML.
  892.  
  893. -------------------------------------------------------------------------------
  894. National Center for Supercomputing Applications / pubs@ncsa.uiuc.edu
  895.